﻿//top
AT.Import(base.Util,function(){
	var lginfo = '';
	var New='';
	if(AT.base.Util.cookie("userid")) {
		var nickname = decodeURIComponent(AT.base.Util.cookie("nickname"));
		var userid = AT.base.Util.cookie("userid");
		var New = AT.base.Util.cookie("msgcount");
		lginfo='<span id="time_good">早上好，</span><a href="http://home.zhubajie.com/'+AT.base.Util.cookie("userid")+'" target="_blank" class="blue2">'+AT.base.Util.cookie("nickname")+'</a><span>欢迎来到猪八戒网！</span>';
		lginfo+='<a href="http://u.zhubajie.com/login/dologout">退出</a>';
		if(New > 0) {
			lginfo+="<a href=\"http://u.zhubajie.com/message/system\" target=\"_blank\">站内信[<b><font color=red>New</font></b>]</a>";
		}else{
			lginfo+="<a href=\"http://u.zhubajie.com/message/system\" target=\"_blank\">站内信</a>";
			}
	} else {
		lginfo+='<span>欢迎来到全球最大的服务交易平台！</span><a href=\"http://u.zhubajie.com/register\" class=\"blue2\">免费注册</a>&nbsp;<a href=\"http://u.zhubajie.com/login\" class=\"blue2\">请登录</a>';
	}
	$("#loginstate").html(lginfo);
	
	//同步登陆
	var activekey=AT.base.Util.cookie("activekey");
	if(activekey) {		
		var frame=$(document.createElement("iframe"));
		frame.attr("style","width:0;height:0;");
		frame.attr("src",activekey);
		$(document.body).append(frame);
		AT.base.Util.cookie('activekey', null, {path: '/',expires:-1,domain:'.zhubajie.com' });
	}
	
	/*通栏导航*/
	var myzbj=$("#tl_myzbj"),
		myzbjc=$("#tl_myzbj .more_con"),
		tl_nav=$("#tl_nav"),
		tl_navlist=$("#tl_nav .more_nav"),
		time_good=$("#time_good");
	myzbj.hover(function(){
		myzbjc.show();
	},function () {
		myzbjc.hide();
	});
	
	tl_nav.hover(function(){
		tl_navlist.show();
	},function () {
		tl_navlist.hide();
	});
	now = new Date(),hour = now.getHours();
	if(hour < 6){time_good.text("凌晨好！")}
	else if (hour < 9){time_good.text("早上好,")}
	else if (hour < 12){time_good.text("上午好,")}
	else if (hour < 14){time_good.text("中午好,")}
	else if (hour < 17){time_good.text("下午好,")}
	else if (hour < 19){time_good.text("傍晚好,")}
	else if (hour < 22){time_good.text("晚上好,")}
	else {time_good.text("夜里好,")}
});